public class TestDate {
    public int year;
    public int month;
    public int day;

   /* public void setData(int y, int m, int d) {
        year = y;
        month = m;
        day = d;
    }*/
    /*
    如果这样的话，输出日期为0--局部变量有限
    三个形参year，month，day在等号左右两边被认为是相同的局部变量
    自己给自己赋值
    根class里的三个变量没关系
     */
    /*public void setData(int year, int month, int day) {
        year = year;
        month = month;
        day = day;
    }*/
    //如果想要这么写，就需要用到this
   public void setDate(int year, int month, int day) {
       this.year = year;
       this.month = month;
       this.day = day;
   }
    public void printData() {
        System.out.println(year + "-" + month + "-" + day);
    }

    public static void main(String[] args) {
        TestDate testDate = new TestDate();

    }

    public static void main1(String[] args) {
        TestDate td = new TestDate();
        TestDate td2 = new TestDate();
        td2.setDate(2024, 1, 17);
        td.setDate(2024, 1, 16);
        td.printData();
        td2.printData();
    }
}
